<!--
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright (c) 2014 Mozilla Corporation
-->

<template name="menu">
    <div class="container headercontainer">
        {{#if haveFeatures }}
        <div id="header" class="row center">
            <span id="nav-main">
                <ul>
                    <li><a href="/">Home</a></li>
                    {{#if isFeature "kibana"}}
                        <li> <a target="_blank" href={{ resolveKibanaURL mozdef.kibanaURL }}>Kibana</a>
                            <ul>
                                <li>
                                    {{#each kibanadashboards as item}}
                                        {{>kibanaDashboardItem}}
                                    {{/each}}
                                </li>
                            </ul>
                        </li>
                    {{/if}}
                    {{#if isFeature "alerts"}}
                        <li><a href="/alerts/">Alerts</a>
                            <ul>
                                {{#if isFeature "watchlist"}}
                                    <li><a href="/watchlist">watchlist</a></li>
                                {{/if}}
                                {{#if isFeature "ipblocklist"}}
                                    <li><a href="/ipblocklist">ip blocklist</a></li>
                                {{/if}}
                                {{#if isFeature "fqdnblocklist"}}
                                    <li><a href="/fqdnblocklist">fqdn blocklist</a></li>
                                {{/if}}
                                {{#if isFeature "manage-alerts"}}
                                    <li><a href="/manage-alerts">manage alerts</a></li>
                                {{/if}}
                            </ul>
                        </li>
                    {{/if}}
                    {{#if isFeature "investigations"}}
                        <li><a href="/investigations">Investigations</a>
                            <ul>
                                <li><a href="/investigation/new/">new investigation</a></li>
                            </ul>
                        </li>
                    {{/if}}
                    {{#if isFeature "incidents"}}
                        <li><a href="/incidents">Incidents</a>
                            <ul>
                                <li><a href="/incident/new/">new incident</a></li>
                                <li><a href="/incidents/veris/">veris stats</a></li>
                            </ul>
                        </li>
                    {{/if}}
                    {{#if isFeature "about"}}
                        <li><a href="/about">About</a>
                            <ul>
                                <li><a target="_blank" href="https://mozdef.readthedocs.io/en/latest/index.html">Documentation</a></li>
                                <li><a href="/preferences">Preferences</a></li>
                            </ul>
                        </li>
                    {{/if}}
                </ul>
                <label>
                    {{#if loggingIn}}
                    loading
                    {{/if}}
                    {{> loginButtons align="right"}}
                </label>

            </span>

        </div>
        {{/if}}
    </div>
</template>

<template name="kibanaDashboardItem">
    <li>
        <a target=" _blank" href="{{ resolveKibanaURL mozdef.kibanaURL }}#/dashboard/{{id}}">{{name}}</a>
    </li>
</template>

